package com.example.lawyer.databind.itemview;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.databinding.BindingAdapter;
import androidx.databinding.ObservableField;

import com.bumptech.glide.Glide;

public class MessageListItemData {


    public ObservableField<String> username = new ObservableField<>();
    public ObservableField<String> coverurl = new ObservableField<>();
    public ObservableField<String> messages = new ObservableField<>();
    public ObservableField<String> times = new ObservableField<>();



    @BindingAdapter("setcover")
    public static void SetCover(View view, String url)
    {
        if(url==null)
        {
            return;
        }
        Glide.with(view).load(url).into((ImageView) view);
    }


    @BindingAdapter("timeconvert")
    public static void TimeConvert(View view,String times)
    {
        if(times==null)
        {
            return;
        }
        TextView textView = (TextView) view;
        textView.setText(times);
    }
}
